package me.lijf.xapi.controller;

import me.lijf.xapi.dto.RestResponse;
import me.lijf.xapi.entity.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class EchoController {
    @PostMapping("/")
    public RestResponse echo(HttpServletRequest request){
        User user= (User) request.getAttribute("sessionUser");
        return RestResponse.success("Hello, "+user.getName());
    }
}
